package com.ashen.study.aop.cglib;








import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;


/**
 * @author hxl
 * @Classname DemoMethodInterceptor
 * @Description
 * @Date 2019/9/24 17:46
 */
public class DemoMethodInterceptor implements MethodInterceptor {


    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        System.out.println("cglib before..............................");
        Object result = null;
        try {
            result = methodProxy.invokeSuper(o, objects);
        } catch (Exception e) {
            System.out.println("cglib Exception.................");
            e.printStackTrace();
        } finally {
            System.out.println("cglib finally........................");
        }
        return result;
    }


}
